<template>
	<view>
		<view v-if="vuex_isMobile" class="content-dept-m">
			<view class="title">
				科室介绍
			</view>
			<view class="dept-box-item" v-for="(item, index) in deptList" :key="index">
				<view class="dept-cate">
					{{item.label}}
				</view>
				<view class="dept-item-box">
					<view class="dept-item" v-for="(itm, idx) in item.cmsContentDeptList" @click="chooseDept(itm)">
						<view class="dept-item-name">
							{{itm.name}}
						</view>
					</view>
				</view>
			</view>
		</view>
		<view v-else class="content-dept">
			<view class="title">
				科室介绍
			</view>
			<view class="dept-box-item" v-for="(item, index) in deptList" :key="index">
				<view class="dept-cate">
					{{item.label}}
				</view>
				<view class="dept-item-box">
					<view class="dept-item" v-for="(itm, idx) in item.cmsContentDeptList" @click="chooseDept(itm)">
						<view class="dept-item-name">
							{{itm.name}}
						</view>
						<view class="dept-item-right">
							>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>

</template>

<script>
	import {
		getDeptList,
	} from "@/common/api.js";
	export default {
		data() {
			return {
				activeDept: null,
				deptList: [],
				menuId: ''
			}
		},
		onLoad() {

		},
		methods: {
			getInfo(id) {
				this.menuId = id
				getDeptList({
					menuId: id
				}).then(res => {
					this.deptList = res.data
				})
			},
			chooseDept(item) {
				this.activeDept = item.id
				uni.navigateTo({
					url: '/pages/dept-detail?active=2&id=' + item.id,
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content-dept-m {
		padding: 0 79px;

		.title {
			width: 100%;
			font-weight: 500;
			text-align: center;
			line-height: 104px;
			font-size: 72px;
			color: $maincolor;
			margin-bottom: 72px;
		}

		.dept-box-item {
			margin-bottom: 21px;

			.dept-cate {
				width: 100%;
				background-color: $maincolor;
				color: #FFFFFF;
				line-height: 77px;
				font-size: 43px;
				text-align: center;
				margin-bottom: 36px;
			}

			.dept-item-box {
				display: flex;
				flex-wrap: wrap;

				.dept-item {
					width: 48%;
					margin: 0 1%;
					border: 2px solid #EAEAEA;
					margin-bottom: 36px;

					.dept-item-name {
						color: #434343;
						width: 100%;
						text-align: center;
						line-height: 135px;
						font-weight: 400;
						font-size: 43px;
					}
				}
			}
		}
	}

	.content-dept {
		.title {
			width: 100%;
			font-weight: 500;
			text-align: center;
			line-height: 80px;
			font-size: 24px;
			color: $maincolor;
		}

		.dept-box-item {
			display: flex;
			margin-bottom: 10px;

			.dept-cate {
				width: 120px;
				background-color: $maincolor;
				color: #FFFFFF;
				line-height: 40px;
				height: 40px;
				text-align: center;
				margin-right: 20px;
			}

			.dept-item-box {
				flex: 1;
				display: flex;
				flex-wrap: wrap;

				.dept-item {
					width: 160px;
					margin-right: 10px;
					margin-bottom: 10px;
					display: flex;
					align-items: center;
					justify-content: space-between;
					border: 1px solid #EAEAEA;
					cursor: pointer;


					.dept-item-name {
						color: #434343;
						width: 126px;
						text-align: center;
						line-height: 40px;
						font-weight: 400;
						font-size: 14px;
					}

					.dept-item-right {
						width: 34px;
						text-align: center;
						color: #434343;
						font-size: 14px;
						line-height: 14px;
						border-left: 1px solid #EAEAEA;
					}
				}

				.dept-item-active {
					background-color: $maincolor;
					color: #FFFFFF;
					width: 200px;
					line-height: 40px;
					height: 40px;
					border-radius: 10px;
					padding-left: 30px;
					padding-right: 30px;
					margin-right: 25px;
					margin-bottom: 20px;
					display: flex;
					align-items: center;
					justify-content: space-between;
					cursor: pointer;
				}
			}
		}
	}
</style>